package com.bsj.pay.service.impl;

import com.bsj.pay.dao.StoreDao;
import com.bsj.pay.model.StoreBean;
import com.bsj.pay.service.StoreService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chhuean
 * @version 1.0
 * @date 2022/12/16
 **/
@Service
public class StoreServiceImpl implements StoreService {
    private static final Logger logger = LogManager.getLogger(GoodsServiceImpl.class);
    @Autowired
    private StoreDao dao;


    @Override
    public long insert(StoreBean t) {
        return dao.insert(t);
    }

    @Override
    public int deleteById(Long id) {
        return dao.deleteById(id);
    }

    @Override
    public int removeById(Long id) {
        return dao.removeById(id);
    }

    @Override
    public int update(StoreBean t) {
        return dao.update(t);
    }

    @Override
    public StoreBean getById(Long id) {
        return dao.getById(id);
    }

    @Override
    public List<StoreBean> queryList(StoreBean t) {
        return dao.queryList(t);
    }

    @Override
    public List<StoreBean> queryAll() {
        return dao.queryAll();
    }

    @Override
    public long count(StoreBean t) {
        return dao.count(t);
    }

    @Override
    public PageInfo<StoreBean> pageList(StoreBean t, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<StoreBean> list = dao.queryList(t);
        PageInfo<StoreBean> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<StoreBean> selectByPhone(String phone) {
        List<StoreBean> list = dao.selectByPhone(phone);
        return list;
    }
}
